<template>
	<view class="plan-card">
		<view class="plan-card-header">
			<view class="haeder-left">
				<u-avatar :src="data.driverPhoto" size="48"></u-avatar>
				<view class="time">
					{{data.name||'--'}}
				</view>
				<custom-tag v-if="data.drivingExperience" cbackground="#E4E4E4" cborder="2rpx solid #E4E4E4"
					:text="data.drivingExperience+'年驾龄'"></custom-tag>
			</view>
			<view class="header-right">
				<text class="number">{{data.orderAcceptanceTime||'--'}}</text>
			</view>
		</view>
		<view class="content">
			<view class="content-top">
				<view class="top-left">
					<u-image width="190rpx" height="104rpx" :src="data.carPhoto" border-radius="16rpx"></u-image>
					<view class="tip">
						附近车辆
					</view>
				</view>
				<view class="top-right">
					<view class="location-start">
						<span class="desc">起步价（10公里内）</span>
						<span class="price">￥{{data.startingPrice||'--'}}</span>
					</view>
					<view class="location-end">
						<span class="desc">每公里（超出10公里）</span>
						<span class="price">￥{{data.kilometerPrice||'--'}}</span>
					</view>
				</view>
			</view>
			<view class="content-bottom">
				<view class="bottom-left">
					<span class="number">{{data.carModel||'未知'}}</span>
				</view>
				<view class="bottom-right">
					<u-image width="26rpx" height="32rpx" src="/static/index/location2.png"></u-image>
					<span class="number">{{data.distance?data.distance.substr(0,4):'--'}}km</span>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import customTag from "../custom-tag.vue"
	export default {
		props: {
			data: {
				type: Object,
				default: {
					address: "",
					age: "",
					carModel: "",
					carPhoto: "",
					certificatePhoto: "",
					driverLicense: "",
					driverPhoto: "",
					drivingExperience: 0,
					kilometerPrice: 0,
					lat: 0,
					lng: 0,
					name: "",
					orderAcceptanceTime: "",
					phone: "",
					publisherId: "",
					remark: "",
					sex: "",
					startingPrice: 0,
					type: "",
					distance: 0,
				}
			},
		},
		components: {
			customTag
		},
	}
</script>

<style lang="scss" scoped>
	.plan-card {
		display: flex;
		flex-direction: column;
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding: 0 24rpx;

		.plan-card-header {
			display: flex;
			justify-content: space-between;
			padding: 16rpx 0;
			border-bottom: 2rpx solid #F3F3F3;

			.haeder-left {
				display: flex;
				align-items: center;

				.time {
					font-family: PingFang SC, PingFang SC;
					font-weight: bold;
					font-size: 28rpx;
					color: #000000;
					text-align: left;
					font-style: normal;
					text-transform: none;
					margin-left: 8rpx;
					max-width: 100rpx;
					text-overflow: ellipsis;
					overflow: hidden;
					white-space: nowrap;
				}
			}

			.header-right {
				font-weight: bold;
				color: #FF7676;
				text-align: left;
				font-style: normal;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;

				.unit {
					font-size: 24rpx;
				}

				.number {
					font-size: 40rpx;
				}
			}
		}

		.content {
			padding: 16rpx 0;

			.content-top {
				display: flex;

				.top-left {
					position: relative;
					width: 190rpx;
					height: 104rpx;
					border: 16rpx;
					overflow: hidden;

					.tip {
						padding: 2rpx 8rpx;
						font-weight: bold;
						font-size: 10px;
						color: #FFFFFF;
						background: linear-gradient(90deg, #FCD610 0%, rgba(252, 214, 16, 0.24) 100%);
						width: 100%;
						position: absolute;
						bottom: 0;
						border-bottom-right-radius: 16rpx;
						border-bottom-left-radius: 16rpx;
					}
				}

				.top-right {
					flex: 1;
					display: flex;
					flex-direction: column;

					.location-start,
					.location-end {
						flex: 1;
						display: flex;
						justify-content: space-between;
						align-items: center;
						padding-left: 16rpx;


						.desc {
							font-weight: 500;
							font-size: 28rpx;
							color: #999999;
						}

						.price {
							font-weight: bold;
							font-size: 28rpx;
							color: #333333;
						}
					}
				}
			}

			.content-bottom {
				display: flex;
				justify-content: space-between;
				padding: 8rpx 0;

				.bottom-right,
				.bottom-left {
					display: flex;
					align-items: center;

					.number {
						font-weight: 500;
						font-size: 12px;
						color: #999999;
						display: block;
					}
				}
			}
		}
	}
</style>